/* Copyright Thanh-Trung Pham, JAIST, 2013 */

package jp.ac.jaist.model;

/**
 *
 * @author Thanh-Trung Pham
 */
public class RMPMarkovTransition {

    private RMPMarkovState m_oSourceState;
    private RMPMarkovState m_oDestinationState;
    private double m_dTransitionProbability;

    /**
     * The constructor.
     * @param sourceState the source state.
     * @param destinationState the destination state.
     * @param transitionProbability the transition probability.
     */
    public RMPMarkovTransition(RMPMarkovState sourceState, RMPMarkovState destinationState, double transitionProbability) {
        m_oSourceState = sourceState;
        m_oDestinationState = destinationState;
        m_dTransitionProbability = transitionProbability;
    }

    /**
     * Get the transition probability.
     * @return the transition probability.
     */
    public double getTransitionProbability() {
        return m_dTransitionProbability;
    }

    /**
     * Get the destination state.
     * @return the destination state.
     */
    public RMPMarkovState getDestinationState() {
        return m_oDestinationState;
    }

    /**
     * Get the source state.
     * @return the source state.
     */
    public RMPMarkovState getSourceState() {
        return m_oSourceState;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }

        if (!(obj instanceof RMPMarkovTransition)) {
            return false;
        }

        RMPMarkovTransition oOtherTransition = (RMPMarkovTransition) obj;

        return getSourceState().getStateName().equals(oOtherTransition.getSourceState().getStateName())
                && getDestinationState().getStateName().equals(oOtherTransition.getDestinationState().getStateName());

    }
}
